<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
	
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=8;" />  
	<title>
		<?php  echo $title_for_layout; ?>
	</title>
	<meta name="title" content="<?php  echo $meta_title;?>" />
	<meta name="keywords" content="<?php  echo $meta_keywords;?>"/>
	<meta name="description" content="<?php  echo $meta_description;	?>"/>
	<?php 
		echo $this->Html->css('style');
		echo $this->Html->css('facebox');
		echo $this->Html->css('datePicker');
	?>
	<!--[if IE 6]>
	<?php //echo $this->Html->script('DD_belatedPNG_0.0.8a-min'); ?>
	<script type="text/javascript">//DD_belatedPNG.fix('.tips_menu,.tips_top,.tips_content,.tips_btm,.tips_HomeActive,.tips_shareActive,.tips_tipsActive,.tips_userActive,.tips_ascottsActive,.tips_inviteActive');</script>
	<![endif]-->
	<!--[if lt IE 7]>
         <script type="text/javascript" src="/js/unitpngfix.js"></script>
	<![endif]-->  

	<script type="text/javascript">
		var webroot = "<?=@$this->webroot; ?>";
		var APP_URL = "<?=@APP_URL?>"; 
		var server = "<?='http://' . env('SERVER_NAME')?>";
		var here = "<?=@$this->here;?>";
		var display_mode = "<?=@display_mode?>";

		
		
	</script>

	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
	<?php 	
		// echo $this->Html->script('jquery/jquery.slide');  
		echo $this->Html->script('facebox');  
		echo $this->Html->script('amcharts/ampie/swfobject');
		echo $this->Html->script('jquery/jquery.datePicker');
		echo $this->Html->script('datePicker');
	?>
	
	<script type="text/javascript">

		var _gaq = _gaq || [];
		_gaq.push(['_setAccount', '<?=@GA_ID?>']);
		_gaq.push(['_trackPageview']);

		(function() {
			var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
			ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
			var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		})();

	</script>
	<?
		if (isset($bodyAttr)) {
			$bodyAttr = " $bodyAttr";
		} else {
			$bodyAttr = null;
		}
	?>

<!--[if lte IE 6]>
<? echo $this->Html->script('ie6/warning.js');  ?>
<script>window.onload=function(){IE6WarningPopup("./js/ie6/");IE6WarningBar();}</script>
<![endif]--> 

</head>

<body>
	<div style='display:none'><?php echo $this->Session->flash(); ?></div>	
	<div class="wrapper" id="wrapper">
		<div class="header">
			<div class="topBar">
				<?
				if($user || $facebook_user)
				{
					if($facebook_user):
						?>
							<span>Welcome <?=$session->read('Auth.User.name')?></span>
						<?
						echo $html->link('<span class="btnBg">Edit Profile</span>','/users/profile',array('class'=>'btn btnBrown01', 'escape'=>false));
						echo $facebook->logout(array('redirect'=>'/users/logout', 'custome'=>true, 'class'=>'fb_button fb_button_medium', 'label'=>'Facebook Logout', 'escape'=>false));
					else:
					?>
						<span>Welcome <?=$session->read('Auth.User.name')?></span>
					<?
						echo $html->link('<span class="btnBg">Edit Profile</span>','/users/profile',array('class'=>'btn btnBrown01', 'escape'=>false));
						echo $html->link('<span class="btnBg">Logout</span>','/users/logout',array('class'=>'btn btnBrown01', 'escape'=>false));
					endif;
				}
				else
				{
					echo $facebook->login(array(
						'perms' => 'email,user_location,user_birthday,friends_location,friends_about_me,user_about_me,user_activities,user_checkins,user_events,user_education_history,user_groups,user_hometown,user_interests,user_likes,user_notes,user_online_presence,user_photo_video_tags,user_photos,user_relationships,user_relationship_details,user_religion_politics,user_status,user_videos,user_website,user_work_history,read_friendlists,read_insights,read_mailbox,read_requests,read_stream,xmpp_login,ads_management'
					)
		);
					echo $html->link('<span class="btnBg">Login</span>','/users/login',array('class'=>'btn btnBrown01', 'escape'=>false));
					echo $html->link('<span class="btnBg">Register</span>','/users/register',array('class'=>'btn btnBrown01', 'escape'=>false));
					
				}
				?>
			</div>
			<ul class="menu">
				<?
				$show=false;
				$title='';
				$active = 0;
				$controller='';
				switch($this->name)
				{	
					case 'Posts':
						switch($this->params['url']['url'])
						{
							case 'index':
								$active = 1;	
								break;
							case 'testimonies':
								$active = 2;
								break;	
							case 'ibless/map':
								$active = 5;
								break;						
							default:
								$active = 1;
								break;	
						}
						break;
						
					case 'Pages':
						$active = 4;	
						break;
					case 'Users':
						switch($this->params['url']['url'])
						{
							case 'admin/users/demographics':
								$active=0;
								$title='Demographics';
								$show=true;
								$controller ='admin_demographics';
								break;
							case 'admin/users/login':
								$active=0;
								$title='Admin Login';
								$controller ='admin_login';
								break;
							default:
								$active=0;
								$title='Member Manager';
								$controller ='admin_member';
								break;						
						}
						break;
						
					default:
						$active=0;
				}	
				?>
			
				<li <?if($active == 1) echo 'class="active"'?>><a href="<?=$this->webroot?>" class="home"></a></li>
				<li <?if($active == 5) echo 'class="active"'?>><a href="<?=$this->webroot.'ibless/map'?>" class="map"></a></li>
				<li <?if($active == 2) echo 'class="active"'?>><a href="<?=$this->webroot.'testimonies'?>" class="testimonies"></a></li>
				<li <?if($active == 4) echo 'class="active"'?>><a href="<?=$this->webroot.'about'?>" class="up40"></a></li>
			</ul>
			<?=$html->link($html->image('logo.png', array('alt'=>'40UP')),'/', array('class'=>'left', 'escape'=>false)) ?>
		</div>
		
		<div class="content">
		<div class="content">
		
		<?if($title=='Demographics'){?>
			<span class="right"><a href="<?=$this->webroot?>admin/users/member">Member Manager</a> | Demographics</span><br>
		<?}else{?>
			<span class="right">Member Manager | <a href="<?=$this->webroot?>admin/users/demographics">Demographics</a></span><br>
		<?}?>

		<div class="grayCol">
			<h2><?=$title?></h2>
		
				<?if($show){?>
		<!-- START OF DATE-->
		<div class="dateContent">
	
			<br>

			<div class="dateBox" style="height:26px">
				
				<?=$form->create('User', array('action' =>$controller, 'type' =>'get' ));?>

				<div class="dateButton" style="float:right;padding-right: 11px;">
					<?=$this->Form->button('Filter', array('class' => '', 'type' => 'submit', 'name'=>'userDisplay')); ?>		
				</div>
				
				<div class="date" style="float:right;padding-right: 10px;">
					<?=$form->input('to',array('id'=>'to', 'class' => 'inputBox', 'label'=>""));?>
				</div>
				<div class="date" style="float:right;padding-right: 10px;padding-top: 2px;font-size: 14px;">
					<label for="to">To: </label>
				</div>
				
				<div class="date" style="float:right;padding-right: 10px;">
					<?=$form->input('from',array('id'=>'from', 'class' => 'inputBox', 'label'=>""));?>
				</div>
				<div class="date"style="float:right;padding-right: 10px;padding-top: 2px;font-size: 14px;" >
					<label for="from">From: </label>
				</div>
			
				<?=$this->Form->end();?>
			</div>	
		</div>
		<!-- END OF DATE -->
		
		<div class="clear"></div>
		
		<?}?>
		<br><br>
			
		<!-- START OF CONTENT -->
			
					<?php echo $content_for_layout; ?>
			
		<!-- END OF CONTENT -->

			</div>
			</div>
			</div>

		
		<div class="footer">
			Copyright&copy; 2011 40UP. All rights reserved.
			
			<span class="right">
			<a href="<?=$this->webroot?>">Home</a>  |  <a href="#">Map</a>  |  <a href="<?=$this->webroot.'testimonies'?>">Testimonies</a>  |  <a href="<?=$this->webroot.'about'?>">40UP</a> | <a href="<?=$this->webroot.'tnc'?>">Terms of conditions</a> | <a href="<?=$this->webroot.'admin/users/member'?>">Admin</a>
			<a href="#wrapper" class="btnUp">Top</a>  
			</span>
		</div>	
	</div>
	<?php echo $this->element('sql_dump'); ?>
	<?php echo $this->Facebook->init();?>
</body>
</html>
	